Skip to content

Sema: Allow protocol typealiases to be accessed from expression conte… #4224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

slavapestov
Copy link
Contributor

No description provided.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test OS X

…xt, as long as they don't depend on 'Self'

Suppose you have this protocol:

protocol P {
  typealias A = Int
  typealias B = Self
}

Clearly, 'P.B' does not make sense, because then the type parameter
would "leak out" of the existential container. However, 'P.A' is totally
fine, it just means 'Int'.

Previously, we would allow 'P.A' in type context, and diagnose on 'P.B'.

However, due to an oversight, neither one was allowed in expression
context, so for example you could not write 'P.A.self', even though
that should just mean 'Int.self'.

Fix this by generalizing performMemberLookup(), and fix up some
diagnostics to be more specific when something is wrong -- we want
to avoid talking about typealiases as 'static members', since that
doesn't really make much sense.

Fixes <https://bugs.swift.org/browse/SR-2314>.
@slavapestov slavapestov force-pushed the protocol-typealias-member-access-fix branch from 521c8d4 to 1c5959a Compare August 11, 2016 06:41
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test OS X

@slavapestov slavapestov force-pushed the protocol-typealias-member-access-fix branch from 1c5959a to a485e52 Compare August 11, 2016 06:52
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test OS X

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test os x

@slavapestov slavapestov merged commit 87e3d02 into swiftlang:master Aug 11, 2016
@slavapestov slavapestov deleted the protocol-typealias-member-access-fix branch August 19, 2016 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant